package com.nowcoder.community.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

import javax.annotation.PostConstruct;
import java.io.File;

/**
 * @author TwfPlayer
 * @date 2023/8/22 12:26
 * @description: TODO
 */
@Configuration
public class Wkconfig {

    private static final Logger logger = LoggerFactory.getLogger(Wkconfig.class);

    @Autowired
    private ThreadPoolTaskScheduler taskScheduler;

    @Value("${wk.image.storage}")
    private String wkImageStorage;
    //初始化,在服务启动时调用
    @PostConstruct
    public void init(){
        File file = new File(wkImageStorage);
        //文件不存在
        if(!file.exists()){
            file.mkdir();
            logger.info("创建WK文件目录:"+wkImageStorage);
        }
    }
}
